<?php

class Clu_Filter_HTMLPurifier implements Zend_Filter_Interface
{
    
    protected $_htmlPurifier = null;
    
    public function __construct($options = null)
    {
        $config = null;
        if (!is_null($options)) {
        	//todo: depending on different input, setup different filters to make it faster
            $config = HTMLPurifier_Config::createDefault(); 
        	foreach ($options as $option) {
        	    $config->set($option[0], $option[1], $option[2]);
        	}
        }
        $uri_def = $config->getDefinition('URI');
        $uri_def->addFilter(new HTMLPurifier_URIFilter_Hvn(), $config);
        $this->_htmlPurifier = new HTMLPurifier($config);
    }

    public function filter($value)
    {
        return $this->_htmlPurifier->purify($value);
    }

}
